package cn.com.shopec.erp.purchase.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.alibaba.fastjson.JSONObject;

import cn.com.shopec.erp.common.page.PageFinder;
import cn.com.shopec.erp.common.page.PageQuery;
import cn.com.shopec.erp.purchase.entity.StockPurchase;
import cn.com.shopec.erp.purchase.service.IStockPurchaseService;

@RequestMapping("/manager/StockPurchaser")
@Controller
public class StockPurchaserController {

	@Resource
	private IStockPurchaseService  stockPurchaseService;
	
	/**
	 * 分页查询次品信息
	 * 
	 * @param packageInfo
	 * @param pageQuery
	 * @param map
	 * @return
	 */
	@RequestMapping("ajaxPageFinderStockPurchaser")
	@ResponseBody
	public String ajaxPageFinderOrderPackage(StockPurchase stockPurchase, PageQuery pageQuery, ModelMap map) {
		JSONObject jsonObj = new JSONObject();
		PageFinder<StockPurchase> pageFinder = stockPurchaseService.queryStockPurchaseForDefective(stockPurchase, pageQuery);
		jsonObj.put("Rows", pageFinder.getData());
		jsonObj.put("Total", pageFinder.getRowCount());
		return jsonObj.toJSONString();
	}
}